import axios from '@/utils/axios'

const addMchApi = '/sp_admin/business/add' // 新增
const updateMchApi = '/sp_admin/business/update' // 编辑
const mchPageApi = '/sp_admin/business/page' // 列表
const mchListApi = '/sp_admin/platform/business_list' // 列表
const mchDetailApi = '/sp_admin/business/detail' // 详情
const mchBaseInfoApi = '/sp_admin/business/info/base' // 基础信息
const resetMchPwApi = '/sp_admin/business/reset_pw' // 密码
const loginMchApi = '/sp_admin/business/login' // 登录二维码
const loginMchStatusApi = '/sp_admin/business/query_login_status' // 登录二维码状态
const getMerchantFlowApi = '/sp_admin/agent/getMerchantFlow' // 获取流量信息

/**
 * @desc 新增
 */
export const addMch = ({ data }) => {
  return axios.post(addMchApi, data)
}

/**
 * @desc 编辑
 */
export const updateMch = ({ data }) => {
  return axios.post(updateMchApi, data)
}

/**
 * @desc 列表
 */
export const mchPage = ({ data }) => {
  return axios.post(mchPageApi, data)
}

/**
 * @desc 列表
 */
export const mchList = ({ data }) => {
  return axios.post(mchListApi, data)
}

/**
 * @desc 详情
 */
export const mchDetail = ({ params }) => {
  return axios({
    url: mchDetailApi,
    method: 'post',
    params: params
  })
}

/**
 * @desc 基础信息
 */
export const mchBaseInfo = ({ params }) => {
  return axios({
    url: mchBaseInfoApi,
    method: 'post',
    params: params
  })
}

/**
 * @desc 密码
 */
export const resetMchPw = ({ data }) => {
  return axios.post(resetMchPwApi, data)
}

/**
 * @desc 登录二维码
 */
export const loginMch = ({ params }) => {
  return axios({
    url: loginMchApi,
    method: 'get',
    params: params
  })
}

/**
 * @desc 登录二维码状态
 */
export const loginMchStatus = ({ params }) => {
  return axios({
    url: loginMchStatusApi,
    method: 'get',
    params: params
  })
}
/**
 * @desc 获取流量信息
 */
export const getMerchantFlow = ({ params }) => {
  return axios({
    url: getMerchantFlowApi,
    method: 'get',
    params
  })
}
